﻿Public Class frm_RePrintBill
#Region "Khai báo biến"
    Dim mvBol_Close As Boolean = False
    Dim mvUrc_Caculator As New urc_Calculator()
    Dim mvCls_IncomeUpdate As New cls_Income_Update
#End Region
#Region "Hàm khởi tạo"
    Private Sub SubM_InitializeForm()
        Me.mvBol_Close = False
        mvUrc_Caculator.txtInput.Text = ""
        mvUrc_Caculator.txtInput.Properties.MaxLength = 16
        mvUrc_Caculator.cmdDot.Text = "-"
        mvUrc_Caculator.gvBol_Flag = True
        mod_Format.Sub_ShowControl(mvUrc_Caculator, 23)
    End Sub
#End Region
#Region "Form events"
    Private Sub frm_DiscountServiceVat_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        If Not mvBol_Close Then
            e.Cancel = True
        End If
    End Sub
    Private Sub frm_DiscountServiceVat_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        SubM_InitializeForm()
    End Sub
#End Region
#Region "Nút Confirm"
    Private Sub cmdConfirm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConfirm.Click
        Dim mvObj_DataTable As New DataTable
        Try
            If Me.mvUrc_Caculator.txtInput.Text.Length = 16 Then
                'Kiểm tra xem hóa đơn có hay không?
                mvObj_DataTable = mvCls_IncomeUpdate.FuncG_Find(Me.mvUrc_Caculator.txtInput.Text)
                If mvObj_DataTable.Rows.Count <> 0 Then
                    Dim mvRpt_Bill As New rpt_Bill
                    mvRpt_Bill.SetParameterValue("ID", Me.mvUrc_Caculator.txtInput.Text)
                    mvRpt_Bill.SetParameterValue("Count", 1)
                    Dim mvFrm_LoadReport As New frm_LoadReport(mvRpt_Bill)
                    mvBol_Close = True
                    Me.Close()
                    mvFrm_LoadReport.ShowDialog()
                Else
                    FunG_Alert("Thông báo lỗi!", "Hệ thống không tìm thấy hóa đơn!", frm_Alert.WTYPE.ERROR)
                    Me.mvUrc_Caculator.txtInput.Focus()
                End If
            Else
                FunG_Alert("Thông báo lỗi!", "Vui lòng kiểm tra lại số hóa đơn!", frm_Alert.WTYPE.STOP)
                Me.mvUrc_Caculator.txtInput.Focus()
            End If
        Catch ex As Exception

        End Try
    End Sub
#End Region
#Region "Nút exit"
    Private Sub cmdExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExit.Click
        mvBol_Close = True
        Me.Close()
    End Sub
#End Region
End Class